package caip2021p.rcv4;

import java.util.*;
import java.io.*;

public class Main {
	static class Student {
		String name;
		int score;

		public Student(String name, int score) {
			this.name = name;
			this.score = score;
		}

	}

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringBuilder sb = new StringBuilder();

		String[] nm = br.readLine().split(" ");
		int n = Integer.parseInt(nm[0]);
		int m = Integer.parseInt(nm[1]);

		int[] scoreLevels = { 0, 30, 50, 60, 80, 100 };
		
		//列表的元素是列表，注意用法
		List<List<Student>> levels = new ArrayList<>();
		for (int i = 0; i <= 5; i++) {
			levels.add(new ArrayList<>());
		}

		for (int i = 0; i < n; i++) {
			String[] input = br.readLine().split(" ");
			String name = input[0];
			int score = Integer.parseInt(input[1]);

			if (score > 80) {
				levels.get(5).add(new Student(name, score));
			} else if (score > 60) {
				levels.get(4).add(new Student(name, score));
			} else if (score > 50) {
				levels.get(3).add(new Student(name, score));
			} else if (score > 30) {
				levels.get(2).add(new Student(name, score));
			} else {
				levels.get(1).add(new Student(name, score));
			}
		}

		// 对每个级别进行排序
		for (int i = 1; i <= 5; i++) {
			//Arrays.sort一样的用法
			Collections.sort(levels.get(i),new Comparator<Student>() {
				@Override
				public int compare(Student s1, Student s2) {
					if (s1.score == s2.score) {
						return s1.name.compareTo(s2.name);
					}
					return s2.score - s1.score; // 降序排列
				}
	        });
	        
	        
		}

		// 处理输出
		for (int i = m; i >= 1; i--) {
			int sum = 0;
			for (int j = i; j >= 1; j--) {
				sum += levels.get(j).size();
			}

			int currentRank = 1;
			int sameScoreCount = 0;

			for (int j = 0; j < levels.get(i).size(); j++) {
				Student student = levels.get(i).get(j);

				if (student.score == 0) {

					sb.append(student.name);
					sb.append("\n");
					continue;
				}

				if (j == 0) {

					sb.append(String.format("%s %d %d/%d %d/%d\n", 
							student.name, i, student.score, scoreLevels[i],currentRank, sum));

				} else {
					if (student.score == levels.get(i).get(j - 1).score) {
						sb.append(String.format("%s %d %d/%d %d/%d\n", 
								student.name, i, student.score, scoreLevels[i],currentRank, sum));
						sameScoreCount++;
					} else {
						currentRank += 1 + sameScoreCount;
						sameScoreCount = 0;
						sb.append(String.format("%s %d %d/%d %d/%d\n", 
								student.name, i, student.score, scoreLevels[i],currentRank, sum));
					}
				}
			}
		}

		System.out.print(sb.toString());
	}
}
